Skip to content

Comments

add heapsort#4

Open
shannami wants to merge 2 commits intomainfrom
homework_pytets
Open

add heapsort#4
shannami wants to merge 2 commits intomainfrom
homework_pytets

Conversation

@shannami
Copy link
Owner

No description provided.

@shannami shannami requested a review from KubEF October 17, 2025 19:58
arr[i], arr[j] = arr[j], arr[i]


def sift_down(arr, i, upper):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Слишком много у вас break

src/heapsort.py Outdated

def sift_down(arr, i, upper):
while True:
L, r = i * 2 + 1, i * 2 + 2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Почему L с заглавной? И почему она назвается одной буквой?

Comment on lines +39 to +61
def test_heapsort_sample_list(sample_list):
arr = sample_list.copy()
heapsort(arr)
assert arr == sorted(sample_list)


def test_heapsort_many_duplicates(many_duplicates):
arr = many_duplicates.copy()
heapsort(arr)
assert arr == sorted(many_duplicates)


def test_heapsort_cases(case_list):
arr = list(case_list)
heapsort(arr)
assert arr == sorted(case_list)


def test_heapsort_random(random_list):
a = random_list.copy()
b = list(a)
heapsort(b)
assert b == sorted(a)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

У вас точно эти тесты работают? Вы же не импортировали conftest

if arr[L] > arr[i]:
swap(arr, i, L)
i = L
lef, rig = i * 2 + 1, i * 2 + 2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Почему не назвать честно left и right?

@KubEF
Copy link
Collaborator

KubEF commented Dec 15, 2025

Чтобы резрешили влить, нажмите "resolve conversation" у комментариев

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants